package fr.inserm.u674.chcdbweb.model.DTO;

public class EAVModality {
	private EAVVariable eavVariable;
	private Tissue tissue;
	private String modality;
	private Boolean deprecated;

	public EAVModality(EAVVariable eavVariable, Tissue tissue, String modality) {
		this.eavVariable = eavVariable;
		this.tissue = tissue;
		this.modality = modality;
	}

	public EAVModality(EAVVariable eavVariable, Tissue tissue) {
		this.eavVariable = eavVariable;
		this.tissue = tissue;
	}

	public EAVModality(EAVVariable eavVariable, Tissue tissue, String modality, Boolean deprecated) {
		this.eavVariable = eavVariable;
		this.tissue = tissue;
		this.modality = modality;
		this.deprecated = deprecated;
	}

	public EAVModality() {
		// TODO Auto-generated constructor stub
	}

	public EAVVariable getEavVariable() {
		return eavVariable;
	}

	public void setEavVariable(EAVVariable eavVariable) {
		this.eavVariable = eavVariable;
	}

	public Tissue getTissue() {
		return tissue;
	}

	public void setTissue(Tissue tissue) {
		this.tissue = tissue;
	}

	public String getModality() {
		return modality;
	}

	public void setModality(String modality) {
		this.modality = modality;
	}

	public void setDeprecated(Boolean deprecated) {
		this.deprecated = deprecated;
	}

	public Boolean isDeprecated() {
		return deprecated;
	}

	public String toString() {
		return eavVariable.toString() + " : " + tissue.toString();
	}

	public boolean equals(Object obj) {
		if (obj instanceof EAVModality && ((EAVModality) obj).getTissue().equals(tissue)
			&& ((EAVModality) obj).getEavVariable().equals(eavVariable)) return true;
		return false;
	}

	public int hashCode() {
		if (tissue != null && eavVariable != null)
			return this.getClass().hashCode() + tissue.hashCode() + eavVariable.hashCode();
		else
			return super.hashCode();
	}

	public EAVModality clone() {
		EAVModality nm = new EAVModality(eavVariable, tissue, modality);
		if(deprecated!=null)
			nm.setDeprecated(deprecated);
		return nm;
	}
}
